.\" Copyright (c) 1985 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)getttyent.3	6.4 (Berkeley) 5/20/86
.\"
.TH GETTTYENT 3  "May 20, 1986"
.UC 6
.SH NAME
getttyent, getttynam, setttyent, endttyent \- get ttys file entry
.SH SYNOPSIS
.nf
.B #include <ttyent.h>
.PP
.B struct ttyent *getttyent()
.PP
.B struct ttyent *getttynam(name)
.B char *name;
.PP
.B setttyent()
.PP
.B endttyent()
.fi
.SH DESCRIPTION
.I Getttyent,
and
.I getttynam
each return a pointer to an object with the
following structure
containing the broken-out
fields of a line from the tty description file.
.RS
.PP
.nf
.so /usr/include/ttyent.h
.ft R
.ad
.fi
.RE
.PP
.IP ty_name \w'ty_comment'u+3
is the name of the character-special file in the directory ``/dev".
For various reasons, it must reside in the directory ``/dev".
.IP ty_getty
is the command (usually
.IR getty (8))
which is invoked by
.I init
to initialize tty line characteristics.
In fact, any arbitrary command can be used;
a typical use is to initiate a terminal emulator in a window system.
.IP ty_type
is the name of the default terminal type connected to this tty line. This
is typically a name from the
.IR termcap (5)
data base.
The environment variable `TERM' is initialized with this name by
.IR getty (8)
or
.IR login (1).
.IP ty_status
is a mask of bit fields which indicate various actions to be allowed on this
tty line. The following is a description of each flag.
.RS
.IP TTY_ON \w'TTY_SECURE'u+3
Enables logins (i.e.,
.IR init (8)
will start the specified ``getty" command
on this entry).
.IP TTY_SECURE
Allows root to login on this terminal. Note that `TTY_ON' must be included
for this to be useful.
.RE
.IP ty_window
is the command to execute for a window system
associated with the line.  The window system will be started before
the command specified in the
.I ty_getty
entry is executed.
If none is specified, this will be null.
.IP ty_comment
is the trailing comment field, if any; a leading delimiter and white space
will be removed.
.PP
.I Getttyent
reads the next
line from the ttys file, opening the file if necessary;
.I setttyent
rewinds the file;
.I endttyent
closes it.
.PP
.I Getttynam
searches from the beginning of the file until a matching
.I name
is found
(or until EOF is encountered).
.SH FILES
/etc/ttys
.SH "SEE ALSO"
login(1), ttyslot(3), ttys(5), gettytab(5), termcap(5), getty(8), init(8)
.SH DIAGNOSTICS
Null pointer
(0) returned on EOF or error.
.SH BUGS
All information
is contained in a static area
so it must be copied if it is
to be saved.
